// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported Workspace */
-const { Clutter, GLib, GObject, Meta, St } = imports.gi;
+const { Clutter, GLib, GObject, Graphene, Meta, St } = imports.gi;
const Background = imports.ui.background;
const DND = imports.ui.dnd;
_init(metaWorkspace, monitorIndex) {
super._init({
style_class: 'window-picker',
+ pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }),
layout_manager: new WorkspaceLayout(metaWorkspace, monitorIndex),
reactive: true,
});
const WORKSPACE_MIN_SPACING = 24;
const WORKSPACE_MAX_SPACING = 80;
+const WORKSPACE_INACTIVE_SCALE = 0.94;
+
var WorkspacesViewBase = GObject.registerClass({
GTypeFlags: GObject.TypeFlags.ABSTRACT,
}, class WorkspacesViewBase extends St.Widget {
this._fitModeAdjustment = fitModeAdjustment;
this._fitModeNotifyId = this._fitModeAdjustment.connect('notify::value', () => {
this._updateVisibility();
+ this._updateWorkspacesState();
this.queue_relayout();
});
return Math.clamp(spacing, WORKSPACE_MIN_SPACING, WORKSPACE_MAX_SPACING);
}
+ _updateWorkspacesState() {
+ const adj = this._scrollAdjustment;
+
+ // Fade and scale inactive workspaces
+ this._workspaces.forEach((w, index) => {
+ const distanceToCurrentWorkspace = Math.abs(adj.value - index);
+
+ const progress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
+
+ const scale = Util.lerp(WORKSPACE_INACTIVE_SCALE, 1, progress);
+ w.set_scale(scale, scale);
+ });
+ }
+
vfunc_allocate(box) {
this.set_allocation(box);
this._workspaces[j].destroy();
this._workspaces.splice(j, 1);
}
+
+ this._updateWorkspacesState();
}
_activeWorkspaceChanged(_wm, _from, _to, _direction) {
metaWorkspace.activate(global.get_current_time());
}
+ this._updateWorkspacesState();
this.queue_relayout();
}
});